﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="home.aspx.cs" Inherits="SampleVoiceForum.home" %>
<%@ Import Namespace="DatabaseLayer" %>

<%
    if (null == Session["sessionId"])
    {
        Session.Add("sessionId", Request.QueryString.Get("session.SessionId"));
        Session.Add("callerId", Request.QueryString.Get("session.CallerId"));
    }
     
     DatabaseFunctions objectDatabaseFunctions = new DatabaseFunctions();
     objectDatabaseFunctions.addAnalytics((String)Session["sessionId"], (String)Session["callerId"], "home.aspx", "Entered home", null);
     objectDatabaseFunctions.deleteCallerListenData((String)Session["sessionId"]);
%>
<?xml version="1.0" encoding="UTF-8" ?>
<vxml version="2.1">
<property name="inputmodes" value="dtmf"/> 
<catch event="connection.disconnect.hangup">
    <submit next="CleanUp.aspx"/>
    <exit/>
</catch>
   <form id="homeMenu">
      <field name="dtmfInput">
         <prompt bargein="true">
            Welcome to Sample Voice Forum.
            Press 1 to record a message.
            Press 2 to listen to recent messages.
         </prompt>

         <grammar mode="dtmf" version="1.0" root="top" inputmodes="dtmf">
            <rule id="top">
                <one-of>
                    <item>1</item>
                    <item>2</item>
                </one-of>
            </rule>
         </grammar>

        <catch event="noinput nomatch">
            <prompt bargein="false">Invalid Input. Please try again.</prompt>
        <reprompt/>
        </catch>

         <filled namelist="dtmfInput" mode="all">
            <if cond="'1' == dtmfInput">
                <goto next="recordMessageUI.aspx" />
            <elseif cond="'2' == dtmfInput"/>
                <goto next="listenMessages.aspx" />
            </if>
            <clear/>
        </filled>
            
      </field>
   </form>
</vxml>